package com.example.serviceheadlines.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.serviceheadlines.service.HeadlinesCategoryService;
import com.example.serviceheadlines.service.IHeadlinesCategorySortService;
import com.tangyuan.common.result.Result;
import com.tangyuan.model.HeadlinesCategory;
import com.tangyuan.model.HeadlinesCategorySort;
import com.tangyuan.model.User;
import com.tangyuan.common.util.CommStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/headlines")
@Slf4j
public class HeadlinesCategoryController {

    @Autowired
    private HeadlinesCategoryService headlinesCategoryService;




    @GetMapping("/getHeadlinesCategory")
    public Result getHeadlinesCategory(@RequestHeader(name = "Authorization", required = false) String token) {
        return headlinesCategoryService.getHeadlinesCategory(token);
    }

    @PostMapping("/updateCategorySort")
    public Result updateCategorySort(@RequestHeader(name = "Authorization", required = false) String token, @RequestBody HeadlinesCategory headlinesCategory) {
        headlinesCategoryService.updateCategorySort(token,headlinesCategory);
        return Result.ok();
    }
}
